package com.course.android.ui.adapter;

import android.view.View;

import com.baselib.android.utils.Logger;
import com.baselib.android.utils.ToastTool;
import com.baselib.android.utils.img.ImageLoader;
import com.baselib.android.view.BaseRAadapter;
import com.course.android.R;
import com.course.android.activity.ActivityIntent;
import com.course.android.ui.adapter_holder.VideoNewsHolder;
import com.course.android.ui.adapter_holder.WebNewsHolder;
import com.course.config.UrlConfig;
import com.course.model.resp.NewsVo;

public class VideoNewsAdapter extends BaseRAadapter<NewsVo, VideoNewsHolder> {


    @Override
    protected VideoNewsHolder creatHolder(View view) {
        return new VideoNewsHolder(view);
    }

    @Override
    protected int getLayoutId(int position) {
        return R.layout.adapter_video_news;
    }

    @Override
    protected void bindData(int position, NewsVo item, VideoNewsHolder holder) {

        Logger.e(UrlConfig.getImageUrl(item.getImg()));
        ImageLoader.getInstance(holder.itemView.getContext()).displayImage(UrlConfig.getImageUrl(item.getImg()),holder.coverIv);
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                ToastTool.show(holder.itemView.getContext(),item.getUrl());
//                ActivityIntent.toWebViewIntent(holder.itemView.getContext(),item.getTitle(),item.getUrl());
            }
        });
    }
}
